<!DOCTYPE html>
<title>Test that removing invalid event listeners from image documents doesn't crash.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
    if (window.testRunner) {
        testRunner.setPopupBlockingEnabled(false);
    }
    var newWindow = window.open("resources/dice.png");
    newWindow.onload =  t.step_func_done(function() {
        newWindow.addEventListener("resize", function () {;});
        try {
            newWindow.removeEventListener("resize", 2);
        } catch (e) {
            assert_equals(e.message, "Failed to execute 'removeEventListener' on 'EventTarget': parameter 2 is not of type 'Object'.");
        }
    });
});
</script>
